package com.lohika 
{
	import flash.display.*;
	import flash.events.*;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.DropShadowFilter;
	import flash.filters.GlowFilter;
	import flash.geom.*;
	
	/**
	 * Basic container 
	 * Here we just programatically draw background
	 * 
	 * @author Vitaly Vrublevskyy
	 */
	public class ChessBoardContainer extends Sprite 
	{
		private var background:Sprite;
		
		public function ChessBoardContainer() 
		{
			background = drawBackgroundChessboard();
			background.mouseEnabled = false;
			background.filters = [ new GlowFilter(0x0, 1, 6, 6, 15, BitmapFilterQuality.HIGH) ];
			addChild(background);
		}
		
		private function drawBackgroundChessboard():Sprite 
		{
			var sprite:Sprite = new Sprite();
			
			var w:uint = Constant.ENTITY_SIZE;
			var h:uint = Constant.ENTITY_SIZE;
			
			var bitmapData:BitmapData = new BitmapData( w * 2, h *2, false, Constant.DARK_COLOR);
			var rect1:Rectangle = new Rectangle(0, 0, w, h);
			var rect2:Rectangle = new Rectangle(w, h, w * 2, h * 2);
			var colorTransform:ColorTransform = new ColorTransform();
			colorTransform.alphaMultiplier = 0.65
			bitmapData.colorTransform(rect1, colorTransform)
			bitmapData.colorTransform(rect2, colorTransform)
			
			sprite.graphics.beginBitmapFill(bitmapData, null, true );
			sprite.graphics.drawRect( 0, 0, w * Constant.ROWS , h * Constant.COLUMNS);
			sprite.graphics.endFill();
			
			
			sprite.alpha = .85;
			return sprite;
		}
		

	}

}